package br.com.biovida.vos;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import org.hibernate.Criteria;

public class BuscaUsuario {
	
	public static void main(String[] args) {

	    EntityManagerFactory factory = Persistence.createEntityManagerFactory("biovidapu");
	    EntityManager manager = factory.createEntityManager();

	    //cuidado, use o import javax.persistence.Query
	    Query query = manager
	        .createQuery("select t from UsuarioVO as t "+
	          "where t.id = :paramFinalizado");
	    query.setParameter("paramFinalizado", 1);
	    
	    List<UsuarioVO> lista = query.getResultList();
	    
	    for (UsuarioVO t : lista) {
	      System.out.println(t.getNome());
	    }
	    
//	    Criteria crit = session.createCriteria(Produto.class);

	    manager.close();
	  }

}
